package cn.ilikes.modules.likes.dbs;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import cn.ilikes.modules.HbaseIndex;
import cn.ilikes.tools.hbase.jpa.annotations.Index;
import cn.ilikes.tools.hbase.jpa.annotations.IndexColumn;
import cn.ilikes.tools.hbase.jpa.annotations.IndexColumn.Store;

@Entity
@Table(name = "ilikes_users", schema = HbaseIndex.ILIKES_SCHEMA)
@Index
public class IlikesUser implements Serializable {

	private static final long serialVersionUID = -3761699395094251410L;

	@Id
	private String loginName;

	@Column(name = "user@password")
	private String password;

	@Column(name = "user@email")
	private String userEmail;

	@OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
	@JoinColumn(name = "baseinfo@userloginName")
	private IlikesUserBaseInfo ilikesUserBaseInfo;

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "likesUser")
	private List<IlikesFolder> ilikesFolders = new ArrayList<IlikesFolder>();

	public String getLoginName() {
		return loginName;
	}

	public String getPassword() {
		return password;
	}

	public String getUserEmail() {
		return userEmail;
	}

	public IlikesUserBaseInfo getIlikesUserBaseInfo() {
		return ilikesUserBaseInfo;
	}

	public void setLoginName(String loginName) {
		this.loginName = loginName;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public void setUserEmail(String userEmail) {
		this.userEmail = userEmail;
	}

	public void setIlikesUserBaseInfo(IlikesUserBaseInfo ilikesUserBaseInfo) {
		this.ilikesUserBaseInfo = ilikesUserBaseInfo;
	}

	public List<IlikesFolder> getIlikesFolders() {
		return ilikesFolders;
	}

	public void setIlikesFolders(List<IlikesFolder> ilikesFolders) {
		this.ilikesFolders = ilikesFolders;
	}

}
